﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <!-- 包含公共的JSP代码片段 -->

<title>餐馆王平台</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="${applicationScope.backendFolder}/js/jquery.js"></script>
<script type="text/javascript" src="${applicationScope.backendFolder}/js/page_common.js"></script>
<link href="${applicationScope.backendFolder}/css/common_style_blue.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="${applicationScope.backendFolder}/css/index_1.css" />

</head>
<body>


<!-- 页面标题 -->
<div id="TitleArea">
	<div id="TitleArea_Head"></div>
	<div id="TitleArea_Title">
		<div id="TitleArea_Title_Content">



					<img border="0" width="13" height="13" src="${applicationScope.backendFolder}/images/title_arrow.gif"/>  添加菜系


		</div>
    </div>
	<div id="TitleArea_End"></div>
</div>


<!-- 主内容区域（数据列表或表单显示） -->
<div id="MainArea">
	<!-- 表单内容 -->
	<%--<form action="${ctx}/foodtype/save" id="addForm" method="post">--%>
	<form action="${ctx}/foodtype" id="addForm" method="post">

		<input type="hidden" name="method" value="save"/>

		<!-- 本段标题（分段标题） -->
		<div class="ItemBlock_Title">
        	<img width="4" height="7" border="0" src="${applicationScope.backendFolder}/images/item_point.gif"> 菜系信息&nbsp;
        </div>
		<!-- 本段表单字段 -->
        <div class="ItemBlockBorder">
            <div class="ItemBlock">
				<div class="ItemBlock2">
					<table cellpadding="0" cellspacing="0" class="mainForm">
						<tr>
							<td width="80px">菜系名称</td>
							<td>
								<input type="text" name="typeName" id="typeName" class="InputStyle" value=""/> * <span id="existsMsg"></span>
							</td>
						</tr>
					</table>
				</div>
            </div>
        </div>

		<!-- 表单操作 -->
		<div id="InputDetailBar">



					 <input type="submit" id="addBtn" value="添加" class="FunctionButtonInput">


            <a href="javascript:history.go(-1);" class="FunctionButton">返回</a>
        </div>
	</form>

</div>


<script>
	$("#typeName").change(function () {
		//alert(1111);

		var typeNameVal = $(this).val();

		$.get("${ctx}/foodtype?method=nameExists", { typeName : typeNameVal}, function (result) {

			//console.log(result);

			    /*success : true,
			    	message : "菜系名称不存在，可以使用！"

			 		success : false,
			    message : "菜系名称已存在，请更换！"*/

			//提示消息
			$("#existsMsg").text(result.message);
			//console.log(result.message);
			if(result.success) {
				$("#existsMsg").css("color", "green");
				//按钮可用
				$("#addBtn").attr("disabled", false);
			} else {
				$("#existsMsg").css("color", "red");
				//按钮禁用
				$("#addBtn").attr("disabled", true);
			}
		}, "json");
	});
</script>


</body>
</html>
